package cz.jm.web.jmlib.client.base;

import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Widget;

/** Bazova trieda povinna pre vsetky presentre. */
public abstract class Presenter {
	/** Spustenie prace presentru s vizualizaciou v predanom canvas-e. */
	public abstract void  go(LayoutPanel workingArea);
	
	
	public static void addCentredWidget(LayoutPanel workingArea, Widget w) {
		final DockPanel centeringPanel = new DockPanel();

	    workingArea.add(centeringPanel);
	    centeringPanel.setSize("100%", "100%");
	      
	    centeringPanel.add(w, DockPanel.CENTER);
	    centeringPanel.setCellHorizontalAlignment(w, HasHorizontalAlignment.ALIGN_CENTER);
		centeringPanel.setCellVerticalAlignment(w, HasVerticalAlignment.ALIGN_MIDDLE);
	}
}
